<?php

/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/

//$factory->define(App\User::class, function (Faker\Generator $faker) {
//    static $password;
//    return [
//        'name' => $faker->name,
//        'email' => $faker->unique()->safeEmail,
//        'password' => $password ?: $password = bcrypt('secret'),
//        'remember_token' => str_random(10),
//    ];
//});
//
//$factory->defineAs(App\User::class,'admin', function (Faker\Generator $faker) {
//    static $password;
//    return [
//        'name' => $faker->name,
//        'email' => $faker->unique()->safeEmail,
//        'password' => $password ?: $password = bcrypt('secret'),
//        'remember_token' => str_random(10),
//        'admin' =>true
//    ];
//});

//$factory->define(App\Models\Post::class, function (Faker\Generator $faker) {
//    return [
//        'title' => $faker->sentence(),
//        'content' => $faker->paragraphs(),
//        'published_at' => $faker->dateTimeBetween('-1 month', '+3 days'),
//    ];
//});


//$factory->define(App\Models\Blog::class,function (Faker\Generator $faker){
//   return [
//       'title' => $faker->sentence(),
//       'content' => $faker->paragraphs(),
//       'recommend' =>$faker->boolean(2),
//       'hot' =>$faker->boolean(2),
//       'published_at' => $faker->dateTimeBetween('-1 month', '+3 days'),
//   ] ;
//});
//
//
//$factory->define(App\Models\Category::class, function (Faker\Generator $faker) {
//    return [
//        'name' =>  $faker->name ,
//        'parent_id' =>  $faker->randomNumber() ,
//        'update_at' =>  $faker->randomNumber() ,
//    ];
//});

$factory->define(App\Models\Category::class, function (Faker\Generator $faker) {
    return [
        'parent_id' =>  $faker->randomNumber() ,
        'name' =>  $faker->name ,
        'hot' =>  $faker->randomNumber() ,
        'image' =>  $faker->word ,
    ];
});

$factory->define(App\Models\Tag::class, function (Faker\Generator $faker) {
    return [
        'name' =>  $faker->name ,
        'update_at' =>  $faker->randomNumber() ,
    ];
});



$factory->define(App\Models\Comment::class, function (Faker\Generator $faker) {
    return [
        'post_id' =>  $faker->randomNumber() ,
        'parent_id' =>  $faker->randomNumber() ,
        'username' =>  $faker->userName ,
        'email' =>  $faker->safeEmail ,
        'content' =>  $faker->text ,
    ];
});

$factory->define(App\Models\Post::class, function (Faker\Generator $faker) {
    return [
        'category_id' =>  factory(App\Models\Category::class)->create()->id  ,
        'title' =>  $faker->word ,
        'slug' =>  $faker->word ,
        'summary' =>  $faker->word ,
        'thumb' =>  $faker->word ,
        'content' =>  $faker->text ,
        'comment_count' =>  $faker->randomNumber() ,
        'view_count' =>  $faker->randomNumber() ,
        'favorite_count' =>  $faker->randomNumber() ,
        'published' =>  $faker->boolean ,
        'published_at' =>  $faker->dateTimeBetween() ,
    ];
});

$factory->define(App\Models\Tag::class, function (Faker\Generator $faker) {
    return [
        'name' =>  $faker->name ,
        'hot' =>  $faker->randomNumber() ,
    ];
});

